const baseURL = "http://180.76.121.47:8001"
function request(options){
  const {url, data, method, header} = options
  return new Promise((resolve, reject) => {
    wx.showLoading({
      title: '老板别急嘛',
    })
    wx.request({
      url: baseURL + url,
      data: data || {},
      method: method || 'GET',
      header: header || {},
      success: function(resp){
        resolve(resp)
      },
      fail: function(e){
        reject(e)
      },
      complete: function(){
        wx.hideLoading({
          success: (res) => {},
        })
      }
    })
  })
}

module.exports ={
  request
}
module.exports.baseURL = baseURL